package study.java.jdk.jdk8._1_stream.collectors.join;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import study.java.jdk.jdk8.DataUtils;
import study.java.jdk.jdk8.User;

import java.util.List;
import java.util.stream.Collectors;

@Slf4j
public class joining_Test {

    private List<User> userLt = DataUtils.buildUserLt();

    /**
     * @param mapper     -Function（映射器）
     * @param downstream -Collector（收集器）
     */
    @Test
    public void test() {
        String count = userLt.stream()
                .map(User::getName)
                .collect(Collectors.joining("&"));
        log.info("{}", count);


        count =  userLt.stream()
                .collect(Collectors.mapping(User::getName, Collectors.joining("*")));
        log.info("{}", count);
    }
}
